#!/usr/bin/env python

import math

# OUT_COL  OUT_ROW   IN_COL  IN_ROW  IN_CHAN
# 15         7       0        3        0 
# 14                 0       0-3     2 or 3
# 13                 0       0-3     4 or 5
# 12                 0       0-3     6 or 7
# 11                 1       0-3     0 or 1
# 10                 1       0-3     2 or 3
# ...
# 1                  3       0-3     4 or 5
# 0                  3       0-3     6 or 7

#jf_map = numpy.zeros((4,4,8,2))
#jf_map[0][0][0] = (15, 1)
#jf_map[0][0][1] = (15, 0)
#jf_map[0][0][2] = (14, 1)
#jf_map[0][0][3] = (14, 0)
#jf_map[0][0][4] = (13, 1)
#jf_map[0][0][5] = (13, 0)
#jf_map[0][0][6] = (12, 1)
#jf_map[0][0][7] = (12, 0)
#jf_map[0][1][0] = (15, 3)
#jf_map[0][1][1] = (15, 2)
#jf_map[0][1][2] = (14, 3)
#
#jf_map[1][0][0] = (12, 1)

def jf_map(asic_row, asic_col, asic_chan):
    x = 15 - asic_col*4 - int(math.floor(asic_chan / 2))
    y = asic_row*2  + 1 - (asic_chan % 2)

    return x+1, -(y+1)




    




    
